import Yssoa from "../yssoa";
import bodyParse from "../yssoa/middleware/BodyParse";
import URLParse from "url-parse";

const _app = Yssoa.instance();
_app.use(bodyParse);

_app.use(async (ctx, next) => {
  const _url = new URLParse(ctx.req.url);
  console.log(`[${ctx.req.method}]: ${_url.pathname}`, ctx.req);
  await next();
  console.log(`[${ctx.req.method}]: ${_url.pathname}`, ctx.res);
});
